<%--
  User: val.jzp
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>门店列表</title>
    <jsp:include page="/include/common.jsp" />
    <script type="text/javascript" src="<c:url value="/resources/lib/jquery/plugin/jquery.form.min.js" />"></script>
    <script type="text/javascript" src="<c:url value="/resources/js/verify.js" />"></script>
    <script type="text/javascript" src="<c:url value="/resources/lib/My97DatePicker/WdatePicker.js" />"></script>
    <script src="<c:url value="/resources/js/ajaxfileupload.js" />"></script>
    <script type="text/javascript">

        $(document).ready(function(){
            $('#dgDepartmentInfo').datagrid({
                url:'<c:url value="/web/depart/getDepartmentInfoListJSON.json" />',
                singleSelect:true,
                title:"问卷列表",
                fit:true,
                fitColumns:true,
                toolbar:'#tbDepartmentInfo',
                rownumbers:true,
                pagination:true,
                pageSize: 20,
                showFooter:true,
                columns:[[
                    {field:'departmentInfoId',title:'编号',width:8,align:'center'},
                    {field:'departmentNum',title:'门店编号',width:8,align:'center'},
                    {field:'departmentName',title:'门店名称',width:8,align:'center'},
                    {field:'departmentChannel',title:'门店渠道',width:8,align:'center'},
                    {field:'interviewUserName',title:'访问员姓名',width:8,align:'center'},
                    {field:'status',title:'状态',width:8,align:'center'},
//                    {field:'status',title:'状态',width:8,align:'center'},
                    {field:'edit',title:'Edit',align:'center',formatter:function(val,row){
                        if(row.departmentInfoId < 0 || row.departmentInfoId == null) { return ''; }
                        var viewUrl = "<c:url value="/web/depart/getDepartmentInfoEditPage.action?departmentInfoId=" />" + row.departmentInfoId;
                        return '&nbsp;' +
                                '<a href="javascript:void(0)" onclick="openWindow(\'#wDepartmentInfo\', \'' + viewUrl + '\')">编辑</a>' +
                                '&nbsp;';
                    }}
                ]]
            });

            formatPagination("dgDepartmentInfo");

            vEasyUIUtil.createWindow("wDepartmentInfo", {
                title: '新增/编辑',
                width:940,
                height:vSugar.getMaxWinHeight("mainPanel", 900),
                modal:true,
                closed:true,
                collapsible:false,
                minimizable:false,
                maximizable:true,
                iconCls:'icon-save'
            });

            $("#status").combobox({
                valueField:'value',
                textField:'label',
                editable:false,
                data: [
                    {
                        label: '所有门店',
                        value: ''
                    },
                    {
                        label: '待编辑',
                        value: '1'
                    },
                    {
                        label: '已编辑',
                        value: '2'
                    }
                ],
                onSelect:function(record){
                    submitSearch();
                }
            });
        });

        /******************************* 数据操作 *******************************/
        function submitSearch() {
            var dgDepartmentInfo = $('#dgDepartmentInfo');
            dgDepartmentInfo.datagrid('options').pageNumber = 1;
            dgDepartmentInfo.datagrid('getPager').pagination("options").pageNumber = 1;
            var departmentName = $("#departmentName").val();
            var departmentNum = $("#departmentNum").val();
            var param = {
                departmentName: departmentName,
                departmentNum: departmentNum,
                status:$("#status").combobox("getValues").toString()
            };
            dgDepartmentInfo.datagrid({queryParams: param}, 'reload');
        }

        function clearSearch(){
        }
    </script>
</head>
<body class="easyui-layout">

<div data-options="region:'center',border:false" class="mainPanel">
    <div id="tbDepartmentInfo" class="toolBarPadding">
        <div style="float:left;">
            <a href="<c:url value="/web/depart/exportExcelFile.action"/> " class="easyui-linkbutton v-align-middle" data-options="iconCls:'icon-edit',plain:true"
                    >导出数据&nbsp;</a>&nbsp;&nbsp;
            <a href="<c:url value="/web/depart/exportReportForm.action"/> " class="easyui-linkbutton v-align-middle" data-options="iconCls:'icon-edit',plain:true"
                    >导出报表&nbsp;</a>
            <%--<a href="<c:url value="/web/depart/test.action"/> " class="easyui-linkbutton v-align-middle" data-options="iconCls:'icon-edit',plain:true"--%>
                    <%-->测试&nbsp;</a>--%>
        </div>
        <div style="float:right;">
            <label class="v-align-middle" for="status">状态：</label>
            <input id="status" name="status" value="" />
            门店编号：<input id="departmentNum" name="departmentNum"/>&nbsp;&nbsp;
            门店名称：<input id="departmentName" name="departmentName"/>
            <a href="javascript:void(0)" class="easyui-linkbutton v-align-middle"
               data-options="iconCls:'icon-search',plain:true"
               onclick="submitSearch()">搜索&nbsp;</a>
        </div>
        <div style="clear:both;"></div>
    </div>
    <table id="dgDepartmentInfo"></table>
</div>

</body>
</html>